<?PHP
	require 'config.php';
	
	//connecting to DB
	$vLink = mysql_connect($DBServer, $DBUser, $DBPassword);
	if(!$vLink) 
		die(mysql_error());
	
	//setting session encoding
	mysql_select_db($DBName, $vLink);	
	mysql_query("SET NAMES 'cp1251';", $vLink);
	mysql_query("SET CHARACTER SET 'cp1251';", $vLink);
	mysql_query("SET SESSION collation_connection = 'cp1251_general_ci';", $vLink);
	
	//retrieving params
	$vID = $_GET['id'];
	$vOwner = $_GET['owner_type'];
	$vFileName = $vID . '.jpg';
	$vDestination_0 = $imagesFolders[$vOwner] . $vFileName;
	foreach ($imagesPrefixes as $vPrefix)
	{
		$vDestination = $imagesFolders[$vOwner] . $vPrefix . $vFileName;
		if(file_exists($vDestination))
			unlink($vDestination);
	}
	//sending query
	$vQuery = 'DELETE FROM dikar2011_photos WHERE id ="' . $vID . '" LIMIT 1';	
	mysql_query($vQuery);
	mysql_close($vLink);	
	//printing update result for AS side
	echo $vDestination_0;
?>